package com.sai.jsai.module.system.dal.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sai.jsai.common.starter.mybatisplus.mapper.BaseMapper;
import com.sai.jsai.module.system.dal.entity.SysUserRole;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author jisai
 * @version 0.0.1
 * @Description 系统用户角色关联表 数据访问层
 * @createTime 2024/09/24
 */
@Mapper
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {

    /**
     * 根据用户ID获取角色ID列表
     *
     * @param sysUserId 用户ID
     * @return 角色ID列表
     */
    default List<SysUserRole> selectListByUserId(Long sysUserId) {
        return this.selectList(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUserId));
    }

}
